{% extends 'inquire/base.html' %}

{% block title %}
资产名称查询区
{% endblock %}

{% block startbody %}
    <div class="container-fluid" style="margin: 30px 0 0">
        <div class="row">
            <div class="form-group col-md-3"></div>
            <form action='{% url "inquire:inquire" %}'>
                <div class="form-group col-md-4">
                    <label for="exampleInputEmail1">通过资产查询:</label>
                    <select class="form-control" id="exampleInputEmail1" name="asset">
                        {% for id,name in asset_name %}
                            {% if asset == id %}
                                <option value='{{ id }}' selected>{{ name }}</option>
                            {% else %}
                                <option value='{{ id }}'>{{ name }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
                <br>
                <div class="form-group col-md-2">
                    <button type="submit" class="btn btn-default">查询</button>
                </div>
            </form>
        </div>
    </div> <!-- /container -->
    <hr>

    {% if not duanzi %}
        <table class="table table-striped table-bordered table-hover" style="margin: 20px auto; width: 90%">
            <tr class="info">
                <th>物品</th>
                <th>存放地址</th>
                <th>保管人</th>
                <th>数量</th>
                <th>单位</th>
                <th>资产转移</th>
            </tr>
            {% for foo in show_lines %}
                <tr>
                    <td>{{ foo.0 }}</td>
                    <td>{{ foo.1 }}楼{{ foo.2 }}层{{ foo.3 }}</td>
                    <td>{{ foo.4 }}</td>
                    <td>{{ foo.5 }}</td>
                    <td>{{ foo.6 }}</td>
                    <td width="160px">
                        <a href="{% url 'asset_search:amend' uid=foo.7 %}" class="btn btn-primary">修改</a>
                        <a class="btn btn-info"
                           href="{% url 'asset_turn:asset_turn' %}?stockcontrol_id={{ foo.7 }}">转移</a>
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="7">暂 无 数 据</td>
                </tr>
            {% endfor %}
        </table>

        {% if sum_number.1 != 1 %}
            <div aria-label="Page navigation"
                 style="{% if sum_number.1 < 8 %}width: 300px{% else %}width: 600px{% endif %};margin: 0 auto">
                <ul class="pagination">
                    <li>
                        <a href="{% url 'inquire:inquire' %}?asset={{ asset|default:'' }}&page=1" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    {% for foo in sum_number.0 %}
                        <li>
                            <a href="{% url 'inquire:inquire' %}?asset={{ asset|default:'' }}&page={{ foo }}">{{ foo }}</a>
                        </li>
                    {% endfor %}
                    <li>
                        <a href="{% url 'inquire:inquire' %}?asset={{ asset|default:'' }}&page=9999" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </div>
        {% endif %}
    {% else %}
        {% load static %}
        <style>@import url("https://fonts.googleapis.com/css?family=Dancing+Script:700|Mukta:500|Roboto:400,400i,700,700i");</style>
        <link rel="stylesheet" href="{% static 'inquire.css' %}">
        <div class="ticket">
            <div class="ticket__inner">
                <div class="ticket__border"></div>
                <h2 class="ticket__title">来自<strong><a href="http://jandan.net/duan">jandan</a></strong></h2>
                <p class="ticket__text">{{ duanzi }}</p>
                <h2 class="ticket__title"><strong><a href="{% static 'oo.py' %}">code</a></strong></h2>
            </div>
        </div>
    {% endif %}
{% endblock %}